home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 February: Technology Seed / Mac Tech Seed Feb '97.toast / OpenDoc 1.2b2c1 / OpenDoc / Interfaces / CPlusPlus / RefCtObj.xh < prev    next >
Encoding:
Text File  |  1997-02-13  |  4.5 KB  |  203 lines  |  [TEXT/MPS ]

  1.  
  2. /*
  3.  * This file was generated by the SOM Compiler.
  4.  * FileName: RefCtObj.xh.
  5.  * Generated using:
  6.  *     SOM Precompiler somipc: 2.18
  7.  *     SOM Emitter emitxh.dll: 2.33
  8.  */
  9.  
  10. /*
  11.  * 
  12.  *  Classes defined in this interface
  13.  * 
  14.  */
  15.  
  16.  
  17. #ifndef SOM_ODRefCntObject_xh
  18. #define SOM_ODRefCntObject_xh
  19.  
  20. class ODRefCntObject;
  21.  
  22. #define ODRefCntObject_MajorVersion 1
  23. #define ODRefCntObject_MinorVersion 0
  24.  
  25. /* C++ SOM defs */
  26. #include <somcls.xh>
  27. #include <somcm.xh>
  28.  
  29. /* C++ parent defs */
  30. #ifndef SOM_ODObject_xh
  31. #include <ODObject.xh>
  32. #endif
  33.  
  34. #ifndef ODRefCntObject_API
  35. #define ODRefCntObject_API
  36. /*
  37.  * -- The Class API
  38.  */
  39.  
  40. /*
  41.  * Start of user-defined types:
  42.  */
  43. class SOMClass;
  44. class SOMObject;
  45. class ODFrame;
  46. class ODFacet;
  47. class ODObject;
  48. class ODExtension;
  49. class ODRefCntObject;
  50.  
  51. /*
  52.  * End of user-defined types.
  53.  */
  54.  
  55. #ifdef OLDIBMSOMAPISUPPORT
  56. #define ODRefCntObjectCClassData ODRefCntObjectClassData
  57. #define ODRefCntObjectNewClass(major,minor) somNewVersionedClassReference(ODRefCntObject,major,minor)
  58. #endif
  59.  
  60. /* define xxxMetaClass macro to facilitate (cls ## MetaClass) */
  61. #define ODRefCntObjectMetaClass SOMClass
  62.  
  63. #if PRAGMA_ALIGN_SUPPORTED
  64. #  pragma options align=power
  65. #endif
  66.  
  67. /* The API to the ODRefCntObject class object, and the methods it introduces. */
  68. SOMEXTERN struct ODRefCntObjectClassDataStructure {
  69. #ifdef OLDIBMSOMAPISUPPORT
  70.     SOMClass            *classObject;    /* always zero, use somNewClassReference instead */
  71. #else
  72.     long zero;
  73. #endif
  74.     somStaticClassInfo *sci;
  75.     somDToken        instanceDataToken;
  76.     long reserved [3];
  77.     somMToken InitRefCntObject;
  78.     somMToken Acquire;
  79.     somMToken Release;
  80.     somMToken GetRefCount;
  81. } SOMDLINK ODRefCntObjectClassData;
  82.  
  83. #if PRAGMA_ALIGN_SUPPORTED
  84. #  pragma options align=reset
  85. #endif
  86.  
  87. #if !defined(ODRefCntObject_Class_Source) && !defined(SOM_Module_refctobj_Source)
  88. #if PRAGMA_IMPORT_SUPPORTED
  89. #pragma import list ODRefCntObjectClassData
  90. #endif
  91. #endif
  92.  
  93.  
  94. /*
  95.  * -- Typedefs and inline method declarations for left path inherited methods
  96.  * -- are omitted because this compilation had -museinheritedmethods in effect
  97.  */
  98.  
  99.  
  100. /*
  101.  * -- Typedefs for ODRefCntObject Method Procedures
  102.  */
  103. SOMEXTERN {
  104. typedef void   (* SOMLINK somTD_ODRefCntObject_InitRefCntObject)(ODRefCntObject *somSelf, Environment *ev);
  105. typedef void   (* SOMLINK somTD_ODRefCntObject_Acquire)(ODRefCntObject *somSelf, Environment *ev);
  106. typedef void   (* SOMLINK somTD_ODRefCntObject_Release)(ODRefCntObject *somSelf, Environment *ev);
  107. typedef ODULong   (* SOMLINK somTD_ODRefCntObject_GetRefCount)(ODRefCntObject *somSelf, Environment *ev);
  108. }
  109.  
  110. #endif /* ODRefCntObject_API */
  111.  
  112.  
  113. /*
  114.  * -- This emitter treats Method Tokens as Thunks by default.
  115.  * -- Use the sc modifier "nothunks" to change this default
  116.  */
  117. #undef somresolve_
  118. #define somresolve_(obj,mToken) ((somMethodProc*)((void)obj, mToken))
  119.  
  120. /*
  121.  * -- The C++ Wrapper Class for ODRefCntObject
  122.  */
  123. class ODRefCntObject : public ODObject
  124. {
  125. public:
  126.  
  127. // ODRefCntObject::new registers use of the class object, and then uses somNew
  128. // to allocate memory and load the object method table pointer. 
  129. void *operator new(size_t size)
  130. {
  131.     SOM_IgnoreWarning(size);
  132.     // Allocate memory using the default allocator for ODRefCntObject, and
  133.     // clear mem & set method table pointer, call basic initialization
  134. #ifdef SOMCHKNULL
  135.     void * __somResult = (void *)
  136.       somNewObject(ODRefCntObject);
  137.     SOMCHKNULL(__somResult);
  138.     return __somResult;
  139. #else
  140.     return (void*) somNewObject(ODRefCntObject);
  141. #endif
  142. }
  143.  
  144. // ODRefCntObject::delete uses the default deallocator for the object's class.
  145. void operator delete(void * obj)
  146. {
  147.     if (obj) {
  148.         SOM_Resolve(obj,SOMObject,somFree)
  149.            ( (SOMObject*) obj );
  150.     }
  151. }
  152.  
  153. /* method: InitRefCntObject */
  154. void   InitRefCntObject(Environment *ev)
  155. {
  156.    SOM_ResolveD(this,ODRefCntObject,ODRefCntObject,InitRefCntObject)
  157.     (this,ev);
  158. #ifdef SOMCHKEXCEPT
  159.       SOMCHKEXCEPT;
  160. #endif
  161. }
  162.  
  163. /* method: Acquire */
  164. void   Acquire(Environment *ev)
  165. {
  166.    SOM_ResolveD(this,ODRefCntObject,ODRefCntObject,Acquire)
  167.     (this,ev);
  168. #ifdef SOMCHKEXCEPT
  169.       SOMCHKEXCEPT;
  170. #endif
  171. }
  172.  
  173. /* method: Release */
  174. void   Release(Environment *ev)
  175. {
  176.    SOM_ResolveD(this,ODRefCntObject,ODRefCntObject,Release)
  177.     (this,ev);
  178. #ifdef SOMCHKEXCEPT
  179.       SOMCHKEXCEPT;
  180. #endif
  181. }
  182.  
  183. /* method: GetRefCount */
  184. ODULong   GetRefCount(Environment *ev)
  185. {
  186.    #ifdef SOMCHKEXCEPT
  187.    ODULong __somResult = 
  188.       SOM_ResolveD(this,ODRefCntObject,ODRefCntObject,GetRefCount)
  189.     (this,ev);
  190.       SOMCHKEXCEPT;
  191.    return __somResult;
  192. #else
  193.    return SOM_ResolveD(this,ODRefCntObject,ODRefCntObject,GetRefCount)
  194.     (this,ev);
  195. #endif
  196. }
  197.  
  198. };   /* ODRefCntObject */
  199.  
  200.  
  201.  
  202. #endif       /* SOM_ODRefCntObject_xh */
  203.